const _ = require('lodash');
const services = require('../../services');
const enums = require('../../enums');

const commonService = services.common;
const methodService = services.method;

module.exports = (req, res, callback) => {
  const customMethodName = req.body.customMethodName;
  if (_.isEmpty(customMethodName) || !_.isFunction(methodService[customMethodName])) return callback(commonService.getError(enums.errorCode.forbidden));
  methodService[customMethodName](req, res, callback);
};
